{include file="/common/_meta"}

<body>
{include file="/common/top"}
<div class="main-container container-fluid">
	<div class="page-container">
		            <!-- Page Sidebar -->
       {include file="/common/list"}
        <!-- Page Content -->
        <div class="page-content">
            <!-- Page Breadcrumb -->
            <div class="page-breadcrumbs">
                <ul class="breadcrumb">
                   <li>
                        <a href="#">系统</a>
                    </li>
                    <li>
                        <a href="{:url('conf/lst')}">配置管理</a>
                    </li>
                    <li class="active">添加配置</li>
                </ul>
            </div>
            <!-- /Page Breadcrumb -->

            <!-- Page Body -->
            <div class="page-body">

                <div class="row">
                    <div class="col-lg-12 col-sm-12 col-xs-12">
                        <div class="widget">
                            <!-- 配置列表开始 -->
                            <div class="widget-body">
                                <div class="docs-example">
                                    <ul class="nav nav-tabs tabs-flat">
                                        <li class="active"><a href="#info-tab" data-toggle="tab">店铺配置</a></li>
                                        <li class=""><a href="#address-tab" data-toggle="tab">商品配置</a></li>
                                    </ul>
                                    <div class="tab-content tabs-flat">
                                        <div class="tab-pane active" id="info-tab">
                                            <div id="horizontal-form">
                                                <form class="form-horizontal" role="form" action="" method="post" enctype="multipart/form-data">
                                                <?php foreach($shopconfig as $k => $conf):?>
                                                    <div class="form-group">
                                                        <label for="username" class="col-sm-2 control-label no-padding-right"><?php echo $conf['conf_cname']?></label>
                                                        <div class="col-sm-6">
                                                            <!-- 单行文本 -->
                                                            <?php if($conf['conf_formtype']=='input'):?>
                                                            <input value="<?php echo $conf['conf_default']?>" class="form-control" name="<?php echo $conf['conf_ename'];?>" type="text">

                                                            <!-- 文本域 -->
                                                            <?php elseif($conf['conf_formtype']=='textarea'):?>
                                                            <textarea class="form-control" name="<?php echo $conf['conf_ename'];?>"><?php echo $conf['conf_default']?></textarea>

                                                            <!-- 单选 -->
                                                            <?php elseif($conf['conf_formtype']=='radio'):?>
                                                            <div class="radio" style="float: left; padding-right: 10px;">

                                                                <?php if($conf['conf_values']):
                                                                    $arr=explode(',',$conf['conf_values']);
                                                                    foreach($arr as $k1 => $v1):
                                                                ?>
                                                                <label>
                                                                    <input value="<?php echo $v1;?>" class="colored-blue" name="<?php echo $conf['conf_ename'];?>" type="radio" <?php if($conf['conf_default']==$v1){echo 'checked="checked"';}?>  >
                                                                    <span class="text"><?php echo $v1;?></span>
                                                                </label>
                                                                <?php endforeach; endif;?>

                                                            </div>

                                                            <!-- 复选 -->
                                                            <?php elseif($conf['conf_formtype']=='checkbox'):?>
                                                            <div class="checkbox">

                                                                <?php if($conf['conf_values']):
                                                                    $checkboxarr=explode(',',$conf['conf_values']);
                                                                    $defaultarr=explode(',',$conf['conf_default']);
                                                                    foreach($checkboxarr as $k1 => $v1):
                                                                ?>
                                                                <label>
                                                                    <input <?php if(in_array($v1,$defaultarr)){echo 'checked="checked"';}?> class="form-control" name="<?php echo $conf['conf_ename'];?>[]" type="checkbox" value="<?php echo $v1;?>">
                                                                    <span class="text"><?php echo $v1;?></span>
                                                                </label>
                                                                <?php endforeach; endif;?>

                                                            </div>

                                                            <!-- 下拉菜单 -->
                                                            <?php elseif($conf['conf_formtype']=='select'):?>
                                                            <select name="<?php echo $conf['conf_ename'];?>">
                                                                <option>请选择</option>
                                                                <?php if($conf['conf_values']):
                                                                    $selectarr=explode(',',$conf['conf_values']);
                                                                    foreach($selectarr as $k1 => $v1):
                                                                ?>
                                                                <option <?php if($conf['conf_default']==$v1){echo 'selected="selected"';}?> value="<?php echo $v1;?>"><?php echo $v1;?></option>
                                                                <?php endforeach; endif;?>
                                                            </select>


                                                            <!-- 文件上传 -->
                                                            <?php elseif($conf['conf_formtype']=='file'):?>
                                                            <input type="file" name="<?php echo $conf['conf_ename'];?>">
                                                                <?php if($conf['conf_default']):?>
                                                                <img src="__UPLOADS__/{$conf.conf_default}" height="30">
                                                                <?php else:?>
                                                                暂无图片
                                                                <?php endif;?>

                                                            <?php endif;?>
                                                        </div>
                                                    </div>
                                                <?php endforeach; ?>
                                                    <div class="form-group">
                                                        <div class="col-lg-8 col-lg-offset-4">
                                                            <button type="submit" class="btn btn-default">保存信息</button>
                                                        </div>
                                                    </div>
                                            </div>
                                        </div>

                                        <div class="tab-pane" id="address-tab">
                                            <div class="form-horizontal">
                                                <?php foreach($goodsconfig as $k => $conf):?>
                                                    <div class="form-group">
                                                        <label for="username" class="col-sm-2 control-label no-padding-right"><?php echo $conf['conf_cname']?></label>
                                                        <div class="col-sm-6">
                                                            <!-- 单行文本 -->
                                                            <?php if($conf['conf_formtype']=='input'):?>
                                                            <input value="<?php echo $conf['conf_default']?>" class="form-control" name="<?php echo $conf['conf_ename'];?>" type="text">

                                                            <!-- 文本域 -->
                                                            <?php elseif($conf['conf_formtype']=='textarea'):?>
                                                            <textarea class="form-control" name="<?php echo $conf['conf_ename'];?>"><?php echo $conf['conf_default']?></textarea>

                                                            <!-- 单选 -->
                                                            <?php elseif($conf['conf_formtype']=='radio'):?>
                                                            <div class="radio" style="float: left; padding-right: 10px;">

                                                                <?php if($conf['conf_values']):
                                                                    $arr=explode(',',$conf['conf_values']);
                                                                    foreach($arr as $k1 => $v1):
                                                                ?>
                                                                <label>
                                                                    <input value="<?php echo $v1;?>" class="colored-blue" name="<?php echo $conf['conf_ename'];?>" type="radio" <?php if($conf['conf_default']==$v1){echo 'checked="checked"';}?>  >
                                                                    <span class="text"><?php echo $v1;?></span>
                                                                </label>
                                                                <?php endforeach; endif;?>

                                                            </div>

                                                            <!-- 复选 -->
                                                            <?php elseif($conf['conf_formtype']=='checkbox'):?>
                                                            <div class="checkbox">

                                                                <?php if($conf['conf_values']):
                                                                    $checkboxarr=explode(',',$conf['conf_values']);
                                                                    $defaultarr=explode(',',$conf['conf_default']);
                                                                    foreach($checkboxarr as $k1 => $v1):
                                                                ?>
                                                                <label>
                                                                    <input <?php if(in_array($v1,$defaultarr)){echo 'checked="checked"';}?> class="form-control" name="<?php echo $conf['conf_ename'];?>[]" type="checkbox" value="<?php echo $v1;?>">
                                                                    <span class="text"><?php echo $v1;?></span>
                                                                </label>
                                                                <?php endforeach; endif;?>

                                                            </div>

                                                            <!-- 下拉菜单 -->
                                                            <?php elseif($conf['conf_formtype']=='select'):?>
                                                            <select name="<?php echo $conf['conf_ename'];?>">
                                                                <option>请选择</option>
                                                                <?php if($conf['conf_values']):
                                                                    $selectarr=explode(',',$conf['conf_values']);
                                                                    foreach($selectarr as $k1 => $v1):
                                                                ?>
                                                                <option <?php if($conf['conf_default']==$v1){echo 'selected="selected"';}?> value="<?php echo $v1;?>"><?php echo $v1;?></option>
                                                                <?php endforeach; endif;?>
                                                            </select>


                                                            <!-- 文件上传 -->
                                                            <?php elseif($conf['conf_formtype']=='file'):?>
                                                            <input type="file" name="<?php echo $conf['conf_ename'];?>">
                                                                <?php if($conf['conf_default']):?>
                                                                <img src="__UPLOADS__/{$conf.conf_default}" height="30">
                                                                <?php else:?>
                                                                暂无图片
                                                                <?php endif;?>

                                                            <?php endif;?>
                                                        </div>
                                                    </div>
                                                <?php endforeach; ?>
                                                    <div class="form-group">
                                                        <div class="col-lg-8 col-lg-offset-4">
                                                            <button type="submit" class="btn btn-default">保存信息</button>
                                                        </div>
                                                    </div>
                                                </form>
                                            </div>
                                        </div>


                                    </div>

                                </div>
                            </div>
                            <!-- 配置列表结束 -->


                        </div>
                    </div>
                </div>

            </div>
            <!-- /Page Body -->
        </div>
        <!-- /Page Content -->
	</div>
</div>

{include file="common/_footer"}
</body>
</html>